<style>
	.layui-colla-title{background-color: #fff !important;}
</style>
<script src="/js/admincategory/index.js"></script>
<link href="/css/admincategory/index.css" />
 <div class="layui-fluid category-index">
    <div class="layui-card p30">		
		<div class="border-b pb15 f22">分类管理</div>
		<div class="layui-card-body p0 mt15">	
			<div class="layui-collapse no-b">
					 <?php foreach($data as $firstkey=>$firstval){?>
			  <div class="layui-colla-item" id="cate_<?=$firstval['id']?>">
			    <h2 class="layui-colla-title">
						<span id="cate-name-<?=$firstval['id']?>"><?=$firstval['name']?></span>
						
						<div class="fr mr30" >
							<span class="layui-btn layui-btn-xs add-subcate-button" data-id="<?=$firstval['id']?>" data-grade="<?=$firstval['grade']?>">创建子分类</span>
							<span class="layui-btn layui-btn-xs layui-btn-normal cate-update" data-id="<?=$firstval['id']?>"><i class="layui-icon layui-icon-edit"></i>修改</span>
							<span class="layui-btn layui-btn-xs layui-btn-danger cate-delete" data-id="<?=$firstval['id']?>"><i class="layui-icon layui-icon-delete"></i>删除</span>
						</div>
					  </h2>
			    <div class="layui-colla-content layui-show">
						<?php
						if(!empty($firstval['sub'])){
							foreach($firstval['sub'] as $secondkey=>$secondval){?>  							
							<div class="layui-collapse no-b" id="cate_<?=$secondval['id']?>">								
							  <div class="layui-colla-item">
							    <h2 class="layui-colla-title">
									<span id="cate-name-<?=$secondval['id']?>"><?=$secondval['name']?></span>
									<div class="fr mr15">
										<span class="layui-btn layui-btn-xs add-subcate-button" data-id="<?=$secondval['id']?>" data-grade="<?=$secondval['grade']?>">创建子分类</span>
										<span class="layui-btn layui-btn-xs layui-btn-normal cate-update" data-id="<?=$secondval['id']?>"><i class="layui-icon layui-icon-edit"></i>修改</span>
										<span class="layui-btn layui-btn-xs layui-btn-danger cate-delete" data-id="<?=$secondval['id']?>"><i class="layui-icon layui-icon-delete"></i>删除</span>
									</div>
								</h2>
							    <div class="layui-colla-content layui-show p0">
							     <table class="layui-table m0" lay-even lay-skin="nob">
							       <colgroup>
							         <col>
							         <col width="230">
							       </colgroup>
							       <tbody>
							     	  <?php
							     	  if(!empty($secondval['sub'])){
							     	  foreach($secondval['sub'] as $thirdkey=>$thirdval){?>
							         <tr id="cate_<?=$thirdval['id']?>">
							           <td>
							     		  <span class="third-cate-name ml20" id="cate-name-<?=$thirdval['id']?>"><?=$thirdval['name']?></span>
										</td>
										<td>
										<a class="layui-btn layui-btn-xs  attr-manage" href="/admincategory/category/attrlist?cate_id=<?=$thirdval['id']?>&cate_name=<?=$thirdval['name']?>">属性管理</a>
										<span class="layui-btn layui-btn-xs layui-btn-normal cate-update" data-id="<?=$thirdval['id']?>"><i class="layui-icon layui-icon-edit"></i>修改</span>
										<span class="layui-btn layui-btn-xs layui-btn-danger cate-delete" data-id="<?=$thirdval['id']?>"><i class="layui-icon layui-icon-delete"></i>删除</span>
										</td>							         
							         </tr>
							       <?php }
							       }?>
							       </tbody>
							     </table>
							    </div>
							  </div>							  
							</div> 
									 
						 <?php }
						 }?>
						 
					  </div>
			  </div>
					<?php }?>
			</div>
		</div>
    </div>
  </div>
